// wallhaven 壁纸api
// ignore_for_file: equal_keys_in_map

import 'package:dio/dio.dart';
import 'package:wallpaper/http/dio_instance.dart';

// 搜索壁纸
Future<Response> wallhavenSearch({
  required String q,
  required int page,
  required String type,
  String? ratio,
  String? order,
  String? apikey,
  String? categories,
  String? purity,
}) {
  final params = {
    'apikey': apikey,
    'q': q,
    'categories': categories,
    'purity': purity,
    'sorting': type,
    'order': order,
    'page': page.toString(),
    'ratios': ratio,
  };
  return DioInstance.instance().get(
    path: 'https://wallhaven.cc/api/v1/search',
    param: params,
  );
}

// Nekosia 壁纸
Future<Response> nekosiaSearch({
  required List<String> tags,
  int count = 20,
}) {
  final params = {
    'count': count,
    'additionalTags': tags.join(','),
  };
  return DioInstance.instance().get(
    path: 'https://api.nekosia.cat/api/v1/images/nothing',
    param: params,
  );
}
